<%@ page language="java" import="java.util.*, java.text.*,java.sql.Timestamp,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,com.zjut.zs.hjqk.manager.*, com.zjut.zs.hjqk.dao.*,
com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,com.zjut.an.config.manager.*, com.zjut.an.config.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/plugins/webupload/css/upload/upload.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/plugins/webupload/plugin/ueditor/third-party/webuploader/webuploader.css">				
<script type="text/javascript" src="../plugins/assets/plugins/jquery-3.5.1.min.js"></script>
<script src="<%=request.getContextPath() %>/plugins/webupload/plugin/ueditor/third-party/webuploader/webuploader.min.js"></script>
<style type="text/css">
<!--
.select1 {
	border:1px solid #ccc;
	padding:8px;
	width:200px;
}
-->
</style>
</head>

<body>
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {

ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsSchool school = new ZsSchool();
school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);

AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
ZsHjqkManager xmanager = (ZsHjqkManager) SpringContextUtil.getBean("ZsHjqkManager");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsHjqk hjqk = new ZsHjqk();
ZsUser user = null;
if((session.getAttribute("admin")!=null||session.getAttribute("user")!=null) && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");	
} 	
String url = "&usId="+user.getUsId();
List list = new ArrayList();
if (user!=null) {
	hjqk.setZsUser(user);
	list = xmanager.getDataByInstance(1,100,"hjId","asc",hjqk).getObjects();
}
if(request.getParameter("hjId")!=null) {
	hjqk = xmanager.getData(request.getParameter("hjId"));					
}	
ZsUserStatus userStatus = smanager.getDataByUser(user);
boolean edit=false;
//未确认，被退回允许编辑
if(Status.APPSTATUS_NULL.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NO.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NOTIME.getStatus().equals(userStatus.getAppStatus()))edit=true;
//如果材料填写截止或报考信息填写截止，不允许编辑
if(!Status.ON.getStatus().equals(school.getScAppActive()) || Status.OFF.getStatus().equals(school.getScHjqkActive()) || Status.HIDDEN.getStatus().equals(school.getScHjqkActive()))edit=false;
 %>
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="index.jsp">首页</a></li>
    <li><a href="#">获奖情况</a></li>
    </ul>
    </div>

    <div class="formbody">    
	    <div class="rightinfo">
		    <table class="imgtable">		    
		    <thead>
		    <tr>
		    <th>奖项类别</th>
		    <th>奖项名称</th>
		    <th>获奖时间</th>
		    <th>组织单位</th>
		    <th>获奖奖项</th>
		    <th>操作</th>
		    </tr>
		    </thead>
		    <tbody>
		    <%
		    for (int i=0; i<list.size(); i++){
		    	ZsHjqk obj = (ZsHjqk)list.get(i);
		     %>
		    <tr>
		    <td><%=obj.getHjName() %></td>
		    <td><%=obj.getHjJb() %></td>
		    <td><%=obj.getHjDate() %></td>
		    <td><%=obj.getHjOrg() %></td>
		    <td><%=obj.getHjDj() %></td>
		    <td>
		    <%if(edit){ %>
			<a href="zs_hjqk_zjsfdx.jsp?hjId=<%=obj.getHjId() %><%=url %>" class="tablelink">编辑</a>　
		    <a href="#" onclick="javascript:deleteobj('<%=obj.getHjId() %>');">删除</a>
		    <%} %>
		    </td>
		    </tr>
		    <%} %>
		    </tbody>
		    </table>
		    <br>
	    </div>
    </div>
    					<%if(edit){ %>
						<form id="ff" name="add" role="form" class="form-horizontal" action="" method="post">
							<div id="container" style="width:96%;margin:0 auto;">
								<table id="zxtable" class="imgtable" style="width:100%;margin:0 auto;">
							    <thead>
							    <tr>
							    <th>奖项类别</th>
							    <th>奖项名称</th>
							    <th>获奖时间</th>
							    <th>组织单位</th>
							    <th>获奖奖项</th>	
							    </tr>
							    </thead>
							    <tbody>
							    <tr>
							    <td style="text-indent: 5px;">
							    <select id="hjName" name="hjName" class="dfinput" required>
								    <option value=""></option>
								    <option value="荣誉称号类" <%if("荣誉称号类".equals(html.getInputString(hjqk.getHjName())))out.print("selected"); %>>荣誉称号类</option>
								    <option value="学科竞赛类" <%if("学科竞赛类".equals(html.getInputString(hjqk.getHjName())))out.print("selected"); %>>学科竞赛类</option>
								    <option value="学生工作类" <%if("学生工作类".equals(html.getInputString(hjqk.getHjName())))out.print("selected"); %>>学生工作类</option>
								    <option value="艺术体育类" <%if("艺术体育类".equals(html.getInputString(hjqk.getHjName())))out.print("selected"); %>>艺术体育类</option>
								    <option value="其他" <%if("其他".equals(html.getInputString(hjqk.getHjName())))out.print("selected"); %>>其他</option>
								</select>
							    </td>
							    <td style="text-indent: 5px;"><input id="hjJb" name="hjJb" type="text" class="dfinput" value="<%=html.getInputString(hjqk.getHjJb()) %>" required style="width: 100px"/></td>
							    <td style="text-indent: 5px;"><input id="hjDate" name="hjDate" type="text" class="dfinput" value="<%=html.getInputString(hjqk.getHjDate()) %>" required style="width: 100px"/></td>
							    <td style="text-indent: 5px;"><input id="hjOrg" name="hjOrg" type="text" class="dfinput" value="<%=html.getInputString(hjqk.getHjOrg()) %>" required style="width: 160px"/></td>
							    <td style="text-indent: 5px;"><input id="hjDj" name="hjDj" type="text" class="dfinput" value="<%=html.getInputString(hjqk.getHjDj()) %>" required style="width: 110px"/></td>
							    </tr>
							    </tbody>
							    </table>
							    <input name="hjFiles" type="text" id="hjFiles" value="<%=html.getInputString(hjqk.getHjFiles()) %>"  class="dfinput"  style="display:none;"/>  	
								<input id="hjId" name="hjId" type="text" class="dfinput" value="<%if(null==hjqk.getHjId()){out.print("");}else{out.print(hjqk.getHjId());}; %>" style="display:none;"/>
							    <input id="zsUser.usId" name="zsUser.usId" type="text" class="dfinput" value="<%=hjqk.getZsUser().getUsId()%>" style="display:none;"/>
									<div class="btns">								 
										<button type="submit" class="btn btn-primary btn-sm" style="float:right;margin:10px;">确认保存</button>
								    </div>  
							</div> 
		    			</form>
		    			<%} %>
<div style="margin:50px;"><%out.print(anconfig.getSingleConfigInfoByName("获奖情况填写需知")); %></div>


<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript" charset="UTF-8"></script>
<script src="../plugins/assets/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js" type="text/javascript"  charset="UTF-8"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script> 

		<script type="text/javascript">
		var updateOneAction = '../zsHjqkSave.action?randnum='+Math.floor(Math.random()*1000000);
		var loactionurl = 'zs_hjqk_zjsfdx.jsp?<%=url%>';
			
		$(function(){
		    //jquery.validate
			$("#ff").validate({
				submitHandler: function() {
					//验证通过后 的js代码写在这里
					
					submitFormAdvance();
				}
			})
		})
		
		$('.imgtable tbody tr:odd').addClass('odd');
		

		function deleteobj(hjId) {
			if (confirm("是否确认"))  { 
				$.get("../zsHjqkDelete.action?randnum="+Math.floor(Math.random()*1000000)+"&hjId="+hjId, function(data){
					if(data.flag=="success"){
						alert("删除成功！");
						window.location = loactionurl;
					}else{
						alert("删除失败！");
					}
				}); 
			}
		}
		</script>
		<script src="js/laydate.dev.js" type="text/javascript"></script>
		<script type="text/javascript">
			
			laydate({
				elem: document.getElementById("hjDate")
			});
		</script>
		
<%} %>		
</body>

</html>
